package com.chinasoft.news.mapper;

import com.chinasoft.news.pojo.ArticleCate;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ArticleCateMapper {

    @Select("select * from ev_article_cate where is_delete=0")
    List<ArticleCate> selectArticleCateAll();

    @Insert("insert into ev_article_cate(name,alias,is_delete) values(#{name},#{alias},#{is_delete})")
    int insertArticleCate(ArticleCate articleCate);

    @Select("select * from ev_article_cate where name=#{name} and is_delete=0")
    ArticleCate selectCateByName(String name);

    @Update("update ev_article_cate set is_delete=1 where id=#{id} ")
    int deleteCateById(Integer id);

    @Select("select * from ev_article_cate where id=#{id}")
    ArticleCate selectCateById(Integer id);

    @Update("update ev_article_cate set name=#{name}, alias=#{alias} where id=#{id}")
    int updateArticleCate(@Param("name") String name,@Param("alias") String alias ,@Param("id") Integer id);




}
